package com.tj.jinzao.activity;

import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.tj.jinzao.R;
import com.tj.jinzao.base.BaseActivity;
import com.tj.jinzao.model.ExchangeRecord;

import butterknife.BindView;

/**
 * 兑换记录详情页面
 * Created by wjy on 2019/1/5.
 */
public class ExchangeRecordDetailActivity extends BaseActivity {

    @BindView(R.id.iv_head)
    ImageView mHeadView;
    @BindView(R.id.tv_name)
    TextView mGoodNameView;
    @BindView(R.id.tv_score)
    TextView mScoreView;
    @BindView(R.id.tv_user)
    TextView mUserView;
    @BindView(R.id.tv_phone)
    TextView mPhoneView;
    @BindView(R.id.tv_address)
    TextView mAddressView;
    @BindView(R.id.tv_order)
    TextView mOrderView;
    @BindView(R.id.tv_date)
    TextView mDateView;
    @BindView(R.id.tv_info)
    TextView mInfoView;
    @BindView(R.id.tv_express)
    TextView mExpressView;

    private ExchangeRecord mRecord;

    @Override
    public int getLayoutResource() {
        return R.layout.activity_exchange_record_detail;
    }

    @Override
    protected void setupView() {
        super.setupView();
        bindData();
    }

    @Override
    protected int getLeftButtonResId() {
        return R.mipmap.ic_back;
    }

    public void bindData() {
        mRecord = (ExchangeRecord) getIntent().getSerializableExtra("record");
        if (mRecord != null) {
            Glide.with(this).load(mRecord.getProduct().getImgurl()).into(mHeadView);
            mGoodNameView.setText(mRecord.getProduct().getTitle());
            mScoreView.setText(mRecord.getProduct().getScore() + "积分");

            mUserView.setText(mRecord.getName());
            mPhoneView.setText(String.valueOf(mRecord.getMobile()));
            mAddressView.setText(mRecord.getAddress());

            mOrderView.setText(mRecord.getOrdernum());
            mDateView.setText(mRecord.getCreateTime());
            mInfoView.setText(mRecord.getExpressName());
            mExpressView.setText(mRecord.getExpressNo());
        }
    }


}
